﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace portfolio.Common
{
    public class DancersDBData
    {
        public DancersDBData()
        {
            DanceStylesList = new List<DanceStyleData>();
        }

        public int SongID { get; set; }

        public string Song { get; set; }

        public string Artist { get; set; }
        
        public int? BPM { get; set; }

        public int? SongLengthInSeconds { get; set; }

        public string SongLength { get; set; }

        public string DanceIdentifier { get; set; }

        public string DanceName { get; set; }

        public List<DanceStyleData> DanceStylesList { get; set; }

        public string ConvertSongLengthToMinutesAndSeconds(int length)
        {
            string minutes = ((int)(length / 60)).ToString();
            string seconds = (length % 60).ToString();

            if (int.Parse(seconds) < 10)
            {
                seconds = seconds.Insert(0, "0"); // Example: needed for times like 3:04 
            }

            return minutes + ":" + seconds;
        }

        public int ConvertSongLengthToSeconds(string length)
        {
            string[] minutesAndSeconds = length.Split(':');
            int time = int.Parse(minutesAndSeconds[0]) * 60 + int.Parse(minutesAndSeconds[1]);
            return time;
        }
    }
}
